import os
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
low_path = './low_light_code/eval15/low/'
high_path = './low_light_code/eval15/high/'
img_dir = './test_results/'

low_img = '493.png'

directory = "./subfigure/"
rownum = 3
colnum = 7

test_dir = 'D:/Data/Research_data/dataset/FER/RAFDB/basic/Image/rafdb/test/'
# ['Anger', 'Disgust', 'Fear', 'Happiness', 'Neutral', 'Sadness', 'Surprise']
label_exp = {'1': 'Surprise', '2': 'Fear', '3': 'Disgust', '4': 'Happiness', '5': 'Sadness', '6': 'Anger', '7': 'Neutral'} 

img_paths = []

for i in range(1,8):
    imgs_dir = test_dir + str(i) + '/'
    img_name = os.listdir(imgs_dir)[20]  # 20表示取序列中的某一张图像
    img_path = imgs_dir + img_name
    img_paths.append(img_path)
    # print(img_path)



for item in range(21):
    position = item + 1
    if item > 6:
        position = item + 1
        item = item % 7
    filename = img_paths[item]
    image2display = mpimg.imread(filename)
    plt.subplot(rownum,colnum,position)
    plt.imshow(image2display)
    plt.axis('off')
    print(filename, item)
plt.gca().xaxis.set_major_locator(plt.NullLocator())
plt.gca().yaxis.set_major_locator(plt.NullLocator())
plt.subplots_adjust(top = 1, bottom = 0, right = 1, left = 0, hspace = -0.55, wspace = 0.1)
# plt.margins(0,0)
plt.savefig('./expression_score.png', dpi=300, bbox_inches='tight')  # 保存图片
plt.show()
